<?php
	/**
	 *	Wap Portal Server
	 *
	 *	Copyright (C) 2002 - 2004 Emir Sakic
	 *
	 *	Wap Portal Server
	 *	Developer: Emir Sakic - saka@hotmail.com
	 *  Homepage: http://www.sakic.net
	 *	Date: 15/03/2004
	 * 	Version #: 1.2
	**/

// Add to database
if (isset($update)) {
	// Replace quotes
	if (!get_magic_quotes_gpc()) {
		$elink = str_replace("'","\'",$elink);
		$ejavascript = str_replace("'","\'",$ejavascript);
	}
	$query = "UPDATE wps_emulator SET javascript = '$ejavascript', link = '$elink' WHERE id = 1";
	$result = mysql_query($query)
	    or die("Insert failed");
	$update = 0;
}
?>

  <table width="600">
    <tr>
      <td colspan="2"><a href='index.php' border=0>Home</a> &gt; Emulator Settings</td>
    </tr>
    <tr>
      <td align="center" width="75%"><b>Emulator&nbsp;Options</b></td>
      <td align="center" width="25%"><b>Resources</b></td>
    </tr>
    <tr>
      <td>
        <?// Read news from mySQL database
	$query = "SELECT * FROM wps_emulator WHERE id = 1";
	$result = mysql_query($query);
	$row = mysql_fetch_row($result);
?>
        <form name="form" method="post" action="index.php?option=emulator">
          <p><b>Javascript:</b><br>
            <textarea name="ejavascript" cols="80" rows="10"><?echo $row[1];?></textarea>
            <br>
            <b>Link:</b><br>
            <textarea name="elink" cols="80" rows="5"><?echo $row[2];?></textarea>
          </p>
          <input type="hidden" name="update" value="1">
          <input type="submit" name="Submit" value="Submit">
        </form>

      </td>
      <td valign="top"><b>Javascript:</b><br>
        Script in the header to open the window and call the emulator.<br>
        <br>
        <b>Link:</b><br>
        Link text in the body calling the javascript function.<br>
        Use <b>$url</b> for default address and <b>$name</b> for default title.<br>
        <br>
<?php
	$common->setup_default_emulator();
	$common->display_emulator();
?>
      </td>
    </tr>
  </table>
